import { ElNotification,ElMessageBox,ElMessage } from 'element-plus'
import nprogress from 'nprogress'


// 消息提示 type = "success" "warning" "info" "error"
export function toast(message,type = "success",dangerouslyUseHTMLString = false){
    ElNotification({
        message,
        type,
        dangerouslyUseHTMLString,
        duration:3000
    })
}

export function showModel(content="展示内容",type="warning",title="title"){
    return ElMessageBox.confirm(
        content,
        title,
        {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: type,
        }
      )
}



// 弹窗修改数据
export function alertData(title,val){
  ElMessageBox.prompt('', title, {
    confirmButtonText: 'OK',
    cancelButtonText: 'Cancel',
    inputValue:val
   
  })
    .then(({ value }) => {
      ElMessage({
        type: 'success',
        message: `Your email is:${value}`,
      })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: 'Input canceled',
      })
    })
}

// 显示全屏loading
export function showFullLoading(){
  nprogress.start()
}

// 隐藏全屏loading
export function hideFullLoading(){
  nprogress.done()
}
